package cn.minions.testSpring.Service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jfinal.kit.Ret;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

import cn.minions.testMybatis.SystemAdmin;
import cn.minions.testMybatis.dao.SystemAdminMapper;
import cn.minions.testSpring.Service.TestService;

@Service
public class TestServiceImpl implements TestService {

	@Autowired
	private SystemAdminMapper systemAdminMapper;
	/**
     * 事物测试
     * @return
     */
	public void update(SystemAdmin systemAdmin) {
		System.out.println("=========JfinalTx==========");
//		systemAdmin.setId(2);
		systemAdmin.setLoginName("123as");
		systemAdmin.save();
		Record record = new Record();
        record.set("login_name", "zs");
        Db.save("system_admin", record);
		systemAdminMapper.saveAdmin(systemAdmin);
//		if (true) {            
//            throw new RuntimeException("test");
//        }
        Ret.by("msg", "success");
	}
}
